<a href="http://github.com/angular/angular.js/edit/master/docs/content/error/injector/cdep.ngdoc" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">Circular Dependency</code>
<div><span class="hint">error in component <code ng:non-bindable="">$injector</code>
</span>
</div>
</h1>
<div><pre class="minerr-errmsg" error-display="Circular dependency found: {0}">Circular dependency found: {0}</pre>
<h2 id="description">Description</h2>
<div class="description"><div class="-injector-page -injector-cdep-page"><p>This error occurs when the <a href="api/angular.injector"><code>$injector</code></a> tries to get
a service that depends on itself, either directly or indirectly. To fix this,
construct your dependency chain such that there are no circular dependencies.</p>
<p>For example:</p>
<pre><code>angular.module(&#39;myApp&#39;, [])
  .factory(&#39;myService&#39;, function (myService) {
    // ...
  })
  .controller(&#39;MyCtrl&#39;, function ($scope, myService) {
    // ...
  });</code></pre>
<p>When an instance of <code>MyCtrl</code> is created, the service <code>myService</code> will be created
by the <code>$injector</code>. <code>myService</code> depends on itself, which causes the <code>$injector</code>
to detect a circular dependency and throw the error.</p>
<p>For more information, see the <a href="guide/di">Dependency Injection Guide</a>.</p>
</div></div>
</div>
